<div [@routerTransition]>
    <div class="m-subheader ">
        <div class="d-flex align-items-center">
            <div class="mr-auto col-xs-6">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>材料管理</span>
                </h3>
                <span class="m-section__sub">
                    材料管理的文本头信息
                </span>
            </div>
            <div class="col-xs-6 text-right">
            </div>
        </div>
    </div>

    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">

                <form class="horizontal-form" autocomplete="off">
                    <div class="m-form m-form--label-align-right">
                        <div class="row align-items-center m--margin-bottom-10">
                            <div class="col-xl-12">
                                <div class="form-group m-form__group align-items-center">
                                    <div class="input-group">
                                        <input [(ngModel)]="filterText" name="filterText" autoFocus
                                            class="form-control m-input" [placeholder]="l('SearchWithThreeDot')"
                                            type="text">
                                        <span class="input-group-btn">
                                            <button (click)="getMaterials()" class="btn btn-primary" type="submit">
                                                <i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row margin-bottom-10" *ngIf="advancedFiltersAreShown">
                            <div class="col-sm-12 text-right">
                                <button class="btn btn-metal" (click)="getMaterials()"><i class="fa fa-refresh"></i>
                                    {{l("Refresh")}}</button>
                            </div>
                        </div>
                        <div class="row margin-bottom-10">
                        </div>
                    </div>
                </form>

                <div class="row align-items-center">
                    <!--<Primeng-TurboTable-Start>-->
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                        <p-table #dataTable (onLazyLoad)="getMaterials($event)" [value]="primengTableHelper.records"
                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                            [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                            [resizableColumns]="primengTableHelper.resizableColumns">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 130px" *ngIf="isGranted('Mes58.Pages.Material.Index.Caret')">{{l('Actions')}}</th>
                                    <th style="width: 170px;">任务号</th>
                                    <th style="width: 150px;">图号</th>
                                    <th style="width: 120px;">材料名称</th>
                                    <th style="width: 120px;">数量</th>
                                    <th style="width: 120px;">炉批号</th>
                                    <th style="width: 120px;">质检单号</th>
                                    <th style="width: 120px;">物资编码</th>
                                    <th style="width: 120px;">牌号</th>
                                    <th style="width: 120px;">材料状态</th>
                                    <th style="width: 120px;">规格</th>
                                    <th style="width: 120px;">尺寸</th>
                                    <th style="width: 120px;">计量单位</th>
                                    <th style="width: 120px;">技术条件</th>
                                    <th style="width: 120px;">用途</th>
                                    <th style="width: 120px;">合格证</th>
                                    <th style="width: 120px;">生产日期</th>
                                    <th style="width: 120px;">入库日期</th>
                                    <th style="width: 200px">
                                        备注
                                    </th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit">
                                <tr>
                                    <td style="width: 130px" *ngIf="isGranted('Mes58.Pages.Material.Index.Caret')">
                                        <div class="btn-group dropdown" dropdown container="body">
                                            <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary">
                                                <i class="fa fa-cog"></i><span class="caret"></span>
                                                {{ "Actions" | localize }}
                                            </button>
                                            <ul class="dropdown-menu" *dropdownMenu>
                                                <li>
                                                    <a (click)="editMaterialModal.show(record.id)">{{l('Edit')}}</a>
                                                </li>
                                                <!-- <li>
                                                    <a (click)="returnWl(record.id)">退还物流</a>
                                                </li>
                                                <li>
                                                    <a (click)="logMaterialModal.show(record.id)">查看日志</a>
                                                </li> -->

                                                <!-- <li>
                          <a (click)="deleteMaterial(record)">{{l('Delete')}}</a>
                        </li> -->
                                            </ul>
                                        </div>
                                    </td>
                                    <th style="width: 170px;">{{record.materialForProduct.requestedTaskNum}}</th>
                                    <th style="width: 150px;">{{record.materialForProduct.requestedDrawingNum}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.displayName}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.itemAmount}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.furnaceBatch}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.qualityCheckBillNo}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.materialCode}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.materialModel}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.materialStatus}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.specification}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.size}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.unit}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.techCondition}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.materialUseFor}}</th>
                                    <th style="width: 120px;">{{record.materialForProduct.certificateNo}}</th>
                                    <th style="width: 120px;">
                                        {{record.materialForProduct.productionDate | momentFormat:'YYYY-MM-DD'}}</th>
                                        <th style="width: 120px;">
                                            {{record.materialForProduct.creationTime | momentFormat:'YYYY-MM-DD'}}</th>
                                    <td style="width: 200px">
                                        {{ record.remark}}
                                    </td>
                                </tr>
                            </ng-template>
                        </p-table>
                        <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                            {{l('NoData')}}
                        </div>
                        <div class="primeng-paging-container">
                            <p-paginator rows="{{primengTableHelper.defaultRecordsCountPerPage}}" #paginator
                                (onPageChange)="getMaterials($event)"
                                [totalRecords]="primengTableHelper.totalRecordsCount"
                                [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                            </p-paginator>
                            <span class="total-records-count">
                                共计：{{primengTableHelper.totalRecordsCount}}
                            </span>
                        </div>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>
            </div>
        </div>
    </div>
    <editMaterialModal #editMaterialModal (modalSave)="getMaterials()"></editMaterialModal>
    <logMaterialModal #logMaterialModal (modalSave)="getMaterials()"></logMaterialModal>
</div>
